/*
 * Copyright user2010
 * All rights reserved
 */

package org.myorg.applitest.gui.swing.components.panel;

import javax.swing.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.LayoutStyle;

/**
 *
 * @author user
 */
public class PnlIdtAnmSexDat extends JPanel{
    public PnlIdtAnmSexDat()
    {

        initComponents();
    }


    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();

        

        rbnFemme = new javax.swing.JRadioButton();
        rbnHomme = new javax.swing.JRadioButton();
        dateChooserNaissance = new LbzHrzDateChooser("Né le", 10);
        dateChooserMort = new LbzHrzDateChooser("Mort le", 10);
        dateChooserMort.setVisible(true);

        rbnFemme.setText("Femelle");
        rbnHomme.setText("Male");
        buttonGroup1.add(rbnFemme);
        buttonGroup1.add(rbnHomme);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(dateChooserNaissance)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(dateChooserMort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbnHomme)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rbnFemme)
            )
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(dateChooserNaissance)
                    .addComponent(dateChooserMort)
                    .addComponent(rbnHomme)
                    .addComponent(rbnFemme)))
        );
    }
    public String getDateNaissance() {
        return this.dateChooserNaissance.getDate();
    }
    public String getDateMort() {
        return this.dateChooserNaissance.getDate();
    }

    public String getSexe() {
         if (this.rbnFemme.isSelected()) {
             return "f";
         }
         else if (this.rbnHomme.isSelected()) {
             return "h";
         }
         else {
             return "u";
         }
    }


    private ButtonGroup buttonGroup1;
    private JRadioButton rbnFemme;
    private JRadioButton rbnHomme;
    private LbzHrzDateChooser dateChooserMort;
    private LbzHrzDateChooser dateChooserNaissance;
}
